home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
dev
/
amos
/
ProcLib20.lha
/
ScreenFX
/
MOVING_RAINBOWS.Amos
/
MOVING_RAINBOWS.amosSourceCode
Wrap
AMOS Source Code
|
1993-10-26
|
3KB
|
100 lines
Screen Open 0,320,200,2,0 : Cls 0
_RAIN_SPACE=30 : Rem "Space" between rainbows, in degrees
_RAIN_SPEED=4 : Rem Maximum speed in pixels per second
_RAIN_POS=150 : Rem Central position for the rainbows (hardware coordinate)
_RAIN_AMP=70 : Rem 1/2 the distance over which the rainbows move
Dim RYPOS(360+3*_RAIN_SPACE),RHEIGHT(360,3)
' set up rainbow animation
SET_MOVING_RAINBOWS[_RAIN_AMP,_RAIN_POS,_RAIN_SPACE,0,_RAIN_SPEED]
' display rainbows
_DISPLAY_RAINBOWS[2,_RAIN_SPACE]
' animate rainbows
_ANIMATE_RAINBOWS
' remove rainbows
_REMOVE_RAINBOWS[2,N]
'
Procedure SET_MOVING_RAINBOWS[AMP,POS,RSP2,AFFECTCOL,SPEED]
Shared RYPOS(),RHEIGHT()
RSP1=2*RSP2
RSP0=3*RSP2
RHT=30
Restore _LIST
For R=0 To 3
Set Rainbow R,AFFECTCOL,30,"","",""
For N=0 To 14
Read V : Rain(R,N)=V : Rain(R,29-N)=V
Next N
Next R
_LIST:
Data $1,$2,$3,$4,$5,$6,$7,$8,$9,$A,$B,$C,$D,$E,$F
Data $10,$20,$30,$40,$50,$60,$70,$80,$90,$A0,$B0,$C0,$D0,$E0,$F0
Data $100,$200,$300,$400,$500,$600,$700,$800,$900,$A00,$B00,$C00,$D00,$E00,$F00
Data $110,$220,$330,$440,$550,$660,$770,$880,$990,$AA0,$BB0,$CC0,$DD0,$EE0,$FF0
Degree
For N=1 To 360
RYPOS(N)=AMP*Cos(N)+POS
Y3=AMP*Cos(N)+POS
Y2=AMP*Cos(N+RSP2)+POS
Y1=AMP*Cos(N+RSP1)+POS
Y0=AMP*Cos(N+RSP0)+POS
D1=RHT
If Y0<Y1+D1 and Y0>=Y1 Then D1=Y0-Y1
D2=RHT
If Y1<Y2+D2 and Y1>=Y2 Then D2=Y1-Y2
If Y0<Y2+D2 and Y0>=Y2 Then D2=Y0-Y2
D3=RHT
If Y2<Y3+D3 and Y2>=Y3 Then D3=Y2-Y3
If Y1<Y3+D3 and Y1>=Y3 Then D3=Y1-Y3
If Y0<Y3+D3 and Y0>=Y3 Then D3=Y0-Y3
RHEIGHT(N,1)=D1
RHEIGHT(N,2)=D2
RHEIGHT(N,3)=D3
Next N
For N=361 To 360+RSP0
RYPOS(N)=AMP*Cos(N)+POS
Next N
End Proc
Procedure _DISPLAY_RAINBOWS[SPEED,RSP2]
Shared RYPOS(),RHEIGHT()
RSP1=2*RSP2
RSP0=3*RSP2
RHT=30
Rainbow 0,0,RYPOS(RSP0+1),0
Rainbow 1,0,RYPOS(RSP1+1),0
Rainbow 2,0,RYPOS(RSP2+1),0
Rainbow 3,0,RYPOS(1),0
For N=0 To RHT Step SPEED
Rainbow 0,0,,N
If N<=RHEIGHT(1,1) Then Rainbow 1,0,,N
If N<=RHEIGHT(1,2) Then Rainbow 2,0,,N
If N<=RHEIGHT(1,3) Then Rainbow 3,0,,N
Wait Vbl
Next N
End Proc
Procedure _ANIMATE_RAINBOWS
Shared _RAIN_SPACE,RHEIGHT(),RYPOS(),_RAIN_SPEED
RSP0=3*_RAIN_SPACE
RSP1=2*_RAIN_SPACE
Do
For N=1 To 360 Step _RAIN_SPEED
Rainbow 0,0,RYPOS(N+RSP0),30
Rainbow 1,0,RYPOS(N+RSP1),RHEIGHT(N,1)
Rainbow 2,0,RYPOS(N+_RAIN_SPACE),RHEIGHT(N,2)
Rainbow 3,0,RYPOS(N),RHEIGHT(N,3)
Wait Vbl : Synchro
Exit If Mouse Key=1
Next N
Exit If Mouse Key=1
Loop
End Proc
Procedure _REMOVE_RAINBOWS[SPEED,POS]
Shared RHEIGHT()
RHT=30
For N2=RHT To 0 Step -SPEED
Rainbow 0,0,,N2
If N2<=RHEIGHT(POS,1) Then Rainbow 1,0,,N2
If N2<=RHEIGHT(POS,2) Then Rainbow 2,0,,N2
If N2<=RHEIGHT(POS,3) Then Rainbow 3,0,,N2
Wait Vbl
Next N2
End Proc